/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vista;

import controlador.ControladorBotones;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.util.ArrayList;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;

public class PanelAvanzado extends JPanel {
    
    private Pantalla input;
    
    public PanelAvanzado(Pantalla input) {
        this.input = input;
        setBorder(UIUtils.createBorderTitle("Avanzado"));
        setLayout(new BorderLayout(5, 5));
        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
        panel.add(leftPanel());
        add(panel, BorderLayout.CENTER);
    }
    
    private JPanel leftPanel() {
        JPanel panel = new JPanel(new GridLayout(2, 3, 5, 5));
        ArrayList<JButton> buttons = new ArrayList<JButton>();
        buttons.add(new JButton("Tan("));
        buttons.add(new JButton("Sin("));
        buttons.add(new JButton("Cos("));
        buttons.add(new JButton("n!"));
        buttons.add(new JButton("Log"));
        buttons.add(new JButton("E"));
        
        ControladorBotones listener = new ControladorBotones(input);
        
        for(JButton button: buttons) {
            button.addActionListener(listener);
            button.setFocusable(false);
            panel.add(button);
        }
        
        return panel;
    }
}
